﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CookComputing.XmlRpc;

namespace JeanFish.Blog.XmlRpc
{
    /// <summary>
    /// 定义MovableType的方法。
    /// </summary>
    public interface IMovableType
    {
        /// <summary>
        /// 获取博文分类列表。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("mt.getCategoryList", Description = "获取博文分类列表。")]
        [return: XmlRpcReturnValue(Description = "博文分类列表。")]
        Category[] GetCategoryList(string blogid, string username, string password);
        /// <summary>
        /// 获取指定博文的分类。
        /// </summary>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>博文分类列表</returns>
        [XmlRpcMethod("mt.getPostCategories", Description = "获取指定博文的分类。")]
        Category[] GetPostCategories(string postid, string username, string password);
        /// <summary>
        /// 获取最近发布的博文标题列表。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="numberOfPosts">博文数目</param>
        /// <returns>博文标题列表</returns>
        [XmlRpcMethod("mt.getRecentPostTitles", Description = "获取最近发布的博文标题列表。")]
        PostTitle[] GetRecentPostTitles(string blogid, string username, string password, int numberOfPosts);
        /// <summary>
        /// 获取博文的引用通告。
        /// </summary>
        /// <param name="postid">博文编号</param>
        /// <returns>引用通告</returns>
        [XmlRpcMethod("mt.getTrackbackPings", Description = "获取博文的引用通告。")]
        TrackbackPing[] GetTrackbackPings(string postid);
        /// <summary>
        /// 发布博文。
        /// </summary>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>发布结果</returns>
        [XmlRpcMethod("mt.publishPost", Description = "发布博文。")]
        [return: XmlRpcReturnValue(Description = "发布结果。")]
        bool PublishPost(string postid, string username, string password);
        /// <summary>
        /// 为博文设置分类。
        /// </summary>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="categories">分类</param>
        /// <returns>设置结果</returns>
        [XmlRpcMethod("mt.setPostCategories", Description = "为博文设置分类。")]
        [return: XmlRpcReturnValue(Description = "设置分类结果。")]
        bool SetPostCategories(string postid, string username, string password,
            [XmlRpcParameter(Description = "分类结构中名称不是必须的。")]
            Category[] categories);
        /// <summary>
        /// 获取服务器支持的方法。
        /// </summary>
        /// <returns>服务器支持的方法</returns>
        [XmlRpcMethod("mt.supportedMethods", Description = "获取服务器支持的方法。")]
        [return: XmlRpcReturnValue(Description = "服务器支持的方法。")]
        string[] SupportedMethods();
    }
}
